package com.bc004346.travelus;


import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v4.app.Fragment;
import android.view.View;

import com.bc004346.travelus.fragment.CheckinFragment;
import com.bc004346.travelus.model.abstracts.SingleFragmentActivity;
import com.bc004346.travelus.model.domain.Flight;
import com.bc004346.travelus.utility.NotificationHelper;
import com.bc004346.travelus.utility.Utility;

import java.text.ParseException;

/**
 * Created by Renats on 11/20/2014.
 * Manual checkin activity
 */
public class CheckinActivity extends SingleFragmentActivity {

    public static final int NOTIFICATION_ID = 456;
    public static final String NOTIFICATION_EXTRA = "com.bc004346.travelus.CheckinActivity.Flight";

    private CheckinFragment mFragment;

    @Override
    protected Fragment getFragment() {
        return mFragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        try {
            Utility.onStart(this);
            Flight flight = (Flight) getIntent().getSerializableExtra(NOTIFICATION_EXTRA);
            if(flight != null) NotificationHelper.removeNotification(this, NOTIFICATION_ID);
            mFragment = CheckinFragment.newInstance(flight);
            super.onCreate(savedInstanceState);
            mTopProgressBar.setVisibility(View.INVISIBLE);
        } catch (Exception e) {
            Utility.log(e);
            mStatus.setText(e.getMessage());
        }
    }

    @Override
    public void refresh() {

    }
}
